// api方法声明，所有方法都挂载于 window._api对象上
// 拦截器请在 src/utils/request.js 配置
// 关于请求的细节请查看 src/config/api.js

// 这两个方法本质上就是返回一个对象，可以根据需要自行增加修改
import networkRequest from "./apiConfig";
const get = (url, config) => ({url, method: "get", ...config });
const post = (url, config) => ({url, method: "post", ...config });
const deletes = (url, config) => ({url, method: "delete", ...config });
// 网络错误时toast的提示文字
const netWorkErrorMsg = "网络错误";

/**
 * key 名称取接口名称驼峰写法
 * 其他按照下方示例
 * @type {{homeGetListByCon: (function(*=): Promise<unknown>), supplierChannelGetSupplierList: (function(*=): Promise<unknown>)}}
 * host_flag 接口是否采用加密
 */

const apiList = {
	//登录
	fSysMLogin:param=>networkRequest(post("/f/sys/mLogin", { loading: "加载中...",host_flag:true }),param),
	// 首页我的服务列表
	fAppServeGetMyList:param=>networkRequest(post("/f/appServe/getMyList", { host_flag:true }),param),
	// 卡片列表
	fAppCardGetList:param=>networkRequest(get("/f/appCard/getList", { host_flag:true }),param),
	// 我的卡片列表
	fAppCardGetMyList:param=>networkRequest(get("/f/appCard/getMyList", { host_flag:true }),param),
	// 卡片添加
	fAppCardAddCard:param=>networkRequest(post("/f/appCard/addCard", { host_flag:true }),param),
	// 卡片删除
	fAppCardDelete:param=>networkRequest(post("/f/appCard/delete", { host_flag:true }),param),
	// 新闻列表
	fAppNewsList:param=>networkRequest(get("/f/appNews/list", {host_flag:false }),param),
	// 新闻已读
	fAppNewsReadNews:param=>networkRequest(get("/f/appNews/readNews", {host_flag:false }),param),
	// 服务类型
	fAppServGetTypeList:param=>networkRequest(get("/f/appServe/getTypeList", {host_flag:true }),param),
	// 服务列表
	fAppServeGetList:param=>networkRequest(get("/f/appServe/getList", {host_flag:false }),param),
	// 添加服务
	fappServeAddServe:param=>networkRequest(post("/f/appServe/addServe", {host_flag:true }),param),
	// 移除服务
	fAppServeRemoveServe:param=>networkRequest(post("/f/appServe/removeServe", {host_flag:true }),param),
	// 管理服务
	fAppServeAddServeList:param=>networkRequest(post("/f/appServe/addServeList", { loading: "加载中...",host_flag:true }),param),
	// 菜品类型
	fAppFoodCateList:param=>networkRequest(get("/f/appFood/cateList", {host_flag:false }),param),
	// 菜品详情
	fAppFoodFoodList:param=>networkRequest(get("/f/appFood/foodList", {host_flag:false }),param),
	// 添加订单
	fAppFoodOrderAdd:param=>networkRequest(post("/f/appFoodOrder/add", { loading: "加载中...",host_flag:true }),param),
	// 用户订单
	fAppFoodOrderList:param=>networkRequest(get("/f/appFoodOrder/list", {host_flag:false }),param),
	// 删除订单
	fAppFoodOrderCancel:param=>networkRequest(post("/f/appFoodOrder/cancel", { loading: "加载中...",host_flag:true }),param),
	//上传图片
	sysCommonUpload:param=>networkRequest(post("/sys/common/upload", { loading: "加载中...",host_flag:false }),param),

	
	//通讯录部门
	fSysAddressQueryTreeListDep:param=>networkRequest(get("/f/sys/address/queryTreeListDep", {host_flag:false }),param),
	//通讯录用户包含下级
	fSysAddressQueryByOrgCodeForAppAll:param=>networkRequest(get("/f/sys/address/queryByOrgCodeForAppAll", { loading: "加载中...",host_flag:false }),param),
	//通讯录用户包含下级
	fSysAddressQueryByOrgCodeForAppOne:param=>networkRequest(get("/f/sys/address/queryByOrgCodeForAppOne", { loading: "加载中...",host_flag:false }),param),
	 

	// 通知公告列表
	fSysAnnountCementGetMyAnnouncementTz:param=>networkRequest(get("/f/sys/annountCement/getMyAnnouncementTz", {host_flag:false }),param),
	// 消息列表
	fSysAnnountCementGetMyAnnouncementXx:param=>networkRequest(get("/f/sys/annountCement/getMyAnnouncementXx", {host_flag:false }),param),
	// 通知公告/消息轮询接口
	fSysAnnountCementListByUser:param=>networkRequest(get("/f/sys/annountCement/listByUser", {host_flag:false }),param),
	// 通知公告/消息详情
	fSysAnnountCementQueryById:param=>networkRequest(post("/f/sys/annountCement/queryById", {host_flag:true }),param),
	// 通知/消息设为已读
	fSysAnnountCementEditByAnntIdAndUserId:param=>networkRequest(post("/f/sys/annountCement/editByAnntIdAndUserId", {host_flag:true }),param),
};

//图书借阅
const bookLending = {
	//获取图书列表
	fAppBooksBookList:param=>networkRequest(get("/f/appBooks/bookList", { host_flag:false }),param),
	//书单添加图书
	fAppBooksAddBookList:param=>networkRequest(post("/f/appBooks/addBookList", { loading: "加载中...",host_flag:true }),param),
	//获取图书分类
	fAppBooksCateList:param=>networkRequest(get("/f/appBooks/cateList", { host_flag:true }),param),
	//获取用户书单
	fAppBooksBookListList:param=>networkRequest(get("/f/appBooks/bookListList", { host_flag:false }),param),
	//获取借阅请求
	fAppBooksGetUserBorrowList:param=>networkRequest(get("/f/appBooks/getUserBorrowList", { host_flag:false }),param),
	//添加借阅请求
	fAppBooksApply:param=>networkRequest(post("/f/appBooks/apply", { loading: "加载中...",host_flag:true }),param),
	//订单详情
	fAppBooksGetBorrowByOrderId:param=>networkRequest(get("/f/appBooks/getBorrowByOrderId", { loading: "加载中...",host_flag:false }),param),
	
	//获取orderId
	fAppReportBorrowOrderIdList:param=>networkRequest(get("/f/appBooks/borrowOrderIdList", { loading: "加载中...",host_flag:false }),param),
	//删除图书
	fAppBooksdelBookList:param=>networkRequest(post("/f/appBooks/delBookList", { loading: "加载中...",host_flag:true }),param),
}

//随手拍
const appReport = {
	//随手拍上报
	fAppReportReport:param=>networkRequest(post("/f/appReport/report", { loading: "加载中...",host_flag:true }),param),
	//随手拍上报删除
	fAppReportDelReport:param=>networkRequest(get("/f/appReport/delReport", {host_flag:false}),param),
	//随手拍保存到草稿箱
	fAppReportSave:param=>networkRequest(post("/f/appReport/save", { loading: "加载中...",host_flag:true }),param),
	//获取部门
	fSysDepartGetDeps:param=>networkRequest(get("/f/sys/depart/getDeps", { host_flag:false }),param),
	//处理流程
	fAppReportGetRecords:param=>networkRequest(post("/f/appReport/getRecords", { loading: "加载中...",host_flag:true }),param),
	//驳回
	fAppReportRefuse:param=>networkRequest(post("/f/appReport/refuse", {host_flag:true }),param),
	//处理
	fAppReportHandle:param=>networkRequest(post("/f/appReport/handle", {host_flag:true }),param),
	//上报详情
	fAppReportGetReport:param=>networkRequest(post("/f/appReport/getReport", { loading: "加载中...",host_flag:true }),param),
	//我的上报
	fAppReportMyReport:param=>networkRequest(get("/f/appReport/myReport", { host_flag:false }),param),
	//处理列表
	fAppReportHandleList:param=>networkRequest(get("/f/appReport/handleList", { host_flag:false }),param),
}


// 公共Api
const commonApiList = {
	commonGetQiniuToken:param=>networkRequest(post("api/common/getQiniuToken", { loading: "加载中..." }),param),
};


// 以下为示例

// // 单纯地调用接口(接口名, 接口路径[不包含base路径])
// get('api/index/home1'),
//
// // 调用该接口时，将显示loading并在下方显示文字“加载中”，并在result为false时，显示“加载首页信息失败”的提示
// post('api/index/home3', { loading: '加载中'),

// // 为接口设置一个默认的参数
// get('api/index/home5', {apiParams: { level: 1 } }),

export { netWorkErrorMsg, apiList ,commonApiList,bookLending,appReport};
